<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .out{
            border: 1.5px darkgray dashed;
            width: 20%;
            height: 30px;
            background: linear-gradient(80deg,greenyellow,aqua);
            transition: all 1s;
        }
        .out:hover{
            width: 80%;
            transition: all 1s;
        }
    </style>
    <!-- <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script>
        $(function(){
            $('.out').mouseleave(function(){
                $('.out').css('width','40%')
            })
        })
    </script> -->
</head>
<body>
    <div>
        <div class="out">

        </div>
    </div>

</body>
</html>